/**
 * 
 */
package com.bagtrack.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;


/**
 * @author Brian Boyle
 * Nov 12, 2011
 * 
 */
@Entity
@Table(name = "CAROUSEL")
public class Carousel {

    private Long id;
    private int carourselNumber;
    private List<Flight> flights;

    /**
     * @param carourselNumber
     */
    public Carousel(int carourselNumber) {
        this.carourselNumber = carourselNumber;
    }

    public Carousel() {

    }

    /**
     * @return the id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID")
    public Long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the carourselNumber
     */
    @Column(name = "CAROUSEL_NUM")
    public int getCarourselNumber() {
        return carourselNumber;
    }

    /**
     * @param carourselNumber the carourselNumber to set
     */
    public void setCarourselNumber(int carourselNumber) {
        this.carourselNumber = carourselNumber;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "Carousel [id=" + id + ", carourselNumber=" + carourselNumber + "]";
    }


    /**
     * @return the flights
     */
    @OneToMany(mappedBy = "carousel", fetch = FetchType.LAZY)
    @JsonIgnore
    public List<Flight> getFlights() {
        return flights;
    }

    public void setFlights(List<Flight> flights) {
        this.flights = flights;
    }

}
